package org.vectrics.recruiter.struts;

import javax.servlet.jsp.JspException;

import org.apache.log4j.Category;
import org.vectrics.struts.VectricsActionData;
import org.vectrics.struts.VectricsStrutsAction;
import org.vectrics.user.UserProfile;

public class SaveExperienceAction extends VectricsStrutsAction {
    private static Category log = Category.getInstance(SaveExperienceAction.class);
    public static String ACTION_NAME = "save_exp";
    public static String USER_PARAM = "user";    
    public static String TITLE_PARAM = "roles_entered";    
    public static String DESCRIPTION_PARAM = "desc";
    public static String DATE_START_PARAM = "date_start";
    public static String DATE_END_PARAM = "date_end";

    private boolean newUser = false;
    private UserProfile userProfile = null;
    

    public SaveExperienceAction() {
    	//
    }

    /*
	public ActionForward execute(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)	throws JspException {
        log.debug("doPerform() called");
        String user = request.getParameter("user");
        String cancel = request.getHttpRequest().getParameter("cancel");
        String descriptionParam = request.getHttpRequest().getParameter(DESCRIPTION_PARAM);
        String dateStartParam = request.getHttpRequest().getParameter(DATE_START_PARAM);
        String dateEndParam = request.getParam(DATE_END_PARAM);
        String titleParam = request.getParam("title");

        if (cancel == null) {
            log.debug("doPerform() submit button pressed - saving user experience.");
            
            if (titleParam == null) 
                request.addInvalidParam(TITLE_PARAM, "Title must be entered.");
            if (descriptionParam == null) 
                request.addInvalidParam(DESCRIPTION_PARAM, "Job description must be entered.");
            
            
            if (user.equals("")) {
                log.error("doPerform() - user not specified in params.");
                request.addInvalidParam("user", "User not specified");
            }
            else {
                log.debug("doPerform() - attempting to find user.");
                
                userProfile = RecruitManager.getInstance().getUserProfile(request);
                
                User appUser = null;
                if (userProfile != null) {
                    appUser = userProfile.getUser();
                }

                if (appUser == null) {
                    log.error("doPerform() - could not find user to update: " + user);
                }
                else {
                    log.info("doPerform() - existing user being updated.");
                }
            }
        }
        else {
            log.debug("cancel pressed, no action.");
        }
      
	   return (mapping.findForward("success"));
        
    }*/


	@Override
	protected String doExecute(VectricsActionData actionData)
			throws JspException {
		
		return ("success");
	}


    
}
